<template>
    <div>
        <el-table
                :data="pageResult.records"
                border
                style="width: 100%"
                @selection-change="handleSelectionChange">
            <el-table-column
                    type="selection"
                    width="55">
            </el-table-column>
            <el-table-column
                    fixed
                    prop="id"
                    label="编号">
            </el-table-column>
            <el-table-column
                    label="就诊编号">
                <template slot-scope="scope">
                    {{scope.row.orderCode}}
                </template>
            </el-table-column>
            <el-table-column
                    label="医生姓名">
                <template slot-scope="scope">
                    {{scope.row.hisDoctorEntity.trueName}}
                </template>
            </el-table-column>
            <el-table-column
                    label="患者姓名">
                <template slot-scope="scope">
                    {{scope.row.patientEntity.name}}
                </template>
            </el-table-column>
            <el-table-column
                    prop="amount"
                    label="支付金额">
            </el-table-column>
            <el-table-column
                    label="状态">
                <template slot-scope="scope">
                    {{scope.row.status==0?'未支付':(scope.row.status==1?'已支付':scope.row.status==2?'确认收款':scope.row.status==3?'申请退款':scope.row.status==4?'已退款':scope.row.status==5?'部分支付':scope.row.status==6?'完成交易':'部分退款')}}
                </template>
            </el-table-column>
            <el-table-column
                    fixed="right"
                    label="操作">
                <template slot-scope="scope">
                    <div v-if="scope.row.status==0">
                        <el-button @click="tozhifu(scope.row.id)" type="text" size="small">去支付</el-button>
                    </div>
                    <div v-if="scope.row.status==1">
                        <el-button @click="fayao(scope.row.id)" type="text" size="small">发药</el-button>
                    </div>
                    <div v-if="scope.row.status==2">

                    </div>
                    <div v-if="scope.row.status==3">

                    </div>
                    <div v-if="scope.row.status==4">

                    </div>
                    <div v-if="scope.row.status==5">

                    </div>
                    <div v-if="scope.row.status==6">
                        <el-button  type="text" size="small">完成交易</el-button>
                    </div>
                    <div v-if="scope.row.status==7">

                    </div>
                </template>
            </el-table-column>
        </el-table>
        <el-footer class="case-exam-footer">
            <el-pagination
                    background
                    layout="prev, pager, next"
                    :total="pageResult.total"
                    :page-size="pageResult.size"
                    class="pagination"
                    @current-change="handleIndexChange"
            >
            </el-pagination>
        </el-footer>

        <el-dialog
                title="提示"
                :visible.sync="dialogVisible"
                width="30%">
            <care-pkypayment-h-t-m-l :id="id" v-if="dialogVisible" ></care-pkypayment-h-t-m-l>
        </el-dialog>

    </div>
</template>

<script>

    import CarePkypaymentHTML from './CarePkypaymentHTML.vue'

    import HisCarePky from '../../model/mfy/HisCarePky.js'
    const hisCarePky = HisCarePky.getInstance();

    export default {
        name: "HisCarePky",
        data() {
            return {
                pageResult: {}, //page对象
                params: {},
                dialogVisible:false,
            }
        },
        methods: {
            list() {
                hisCarePky.list(this.params).then(response => {
                    this.pageResult = response.data.data
                })
            },
            handleIndexChange(index) {
                this.params.page = index
                this.list()
            },
            search() {
                this.params.page = 1
                this.list()
            },
            tozhifu(id) {
                this.id=id
                this.dialogVisible=true
            }
        },
        created() {
            this.list();
        },
        components:{
            CarePkypaymentHTML
        }
    }
</script>

<style scoped>

</style>
